<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">
    <style type="text/css">
        .tableStyle{
            margin:10px 0px 5px 0px;
        }
        .gridStyle{
            margin:10px 10px 10px 0px;
        }
        input{
            margin:1px 1px 1px 2px;
        }
        input[type='submit']{
            margin:3px 5px 3px 5px;
            padding:2px 5px 2px 5px;
        }
        .top{
            vertical-align: top;
        }
    </style>
    <h:form>
        <rich:panel header="经济科目" id="nodePanel" styleClass="content-hight">
            <rich:messages globalOnly="true"/>
            <rich:toolbar  itemSeparator="grid" id="tolbar">
                <rich:toolbarGroup>
                    <a4j:commandButton value="新增" execute="@this" render="tolbar,deptinfo"
                                       action="#{economicBean.add}"/>
                    <a4j:commandButton value="修改" execute="@this" render="tolbar,deptinfo"
                                       action="#{economicBean.update}"
                                       disabled="#{economicBean.addOrUpdate or empty economicBean.node}"/>
                    <a4j:commandButton value="删除" render="nodePanel" action="#{economicBean.delete}"
                                       disabled="#{economicBean.addOrUpdate or empty economicBean.node}"/>
                    <a4j:commandButton value="保存" render="nodePanel"  action="#{economicBean.checkSave}"
                                       disabled="#{!economicBean.editStatus}"/>
                    <a4j:commandButton value="取消" execute="@this" render="tolbar,deptinfo"
                                       action="#{economicBean.cancel}"/>
                </rich:toolbarGroup>
            </rich:toolbar>
            <h:panelGrid columns="2" width="100%" columnClasses="top,top" id="edit">
                <h:panelGroup>
                    <rich:tree value="#{economicBean.rootNode}" var="idept"
                               selectionType="ajax" toggleType="client"
                               selectionChangeListener="#{economicBean.selected}"
                               style="width:300px" render="tolbar,deptinfo">
                        <rich:treeNode>
                            <h:outputText value="[#{idept.data.code}]#{idept.data.name}" />
                        </rich:treeNode>
                    </rich:tree>
                </h:panelGroup>
                <h:panelGroup id="deptinfo">
                    <h:panelGrid columns="3" styleClass="gridStyle">
                        <h:outputText value="经济科目代码："/>
                        <h:outputText rendered="#{!economicBean.editStatus}" value="#{economicBean.node.code}"  />
                        <h:inputText rendered="#{economicBean.editStatus}" disabled="#{!economicBean.addOrUpdate}"
                                     id="code" value="#{economicBean.node.code}"/>
                        <rich:message for="code"/>
                        <h:outputText value="经济科目名称："/>
                        <h:outputText rendered="#{!economicBean.editStatus}" value="#{economicBean.node.name}" />
                        <h:inputText rendered="#{economicBean.editStatus}" id="name" value="#{economicBean.node.name}" />
                        <rich:message for="name"/>
                    </h:panelGrid>
                </h:panelGroup>
            </h:panelGrid>
        </rich:panel>
    </h:form>
</html>
